package file;

import java.io.File;
import java.io.FileFilter;

/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/3/6
 **/
public class ListFilesDemo3 {
    public static void main(String[] args) {
        File file = new File(".");
        if (file.isDirectory()) {
            File[] files = file.listFiles(file1 -> file1.getName().endsWith(".txt"));
                for (File file1 : files) {
                    System.out.println(file1.getName());
                }
            }
        }
    }


